<?php 
$frm_sales_report = $this->form_salse;
$tr=Application_Form_FrmLanguages::getCurrentlanguage();
$url_print=$this->url(array('module'=>'report','controller'=>'index','action'=>'print-report'));
define("COM_ADD","<h3>RSMK GROUP CO.,LTD</h3>No.  BA7,  Sangkat Kakab,  Khan Dongkon,  Phnom Penh.<br>
		Tel: (855) 23 956 789, (855) 23-222-266 <br>
		Websit : www.rsmkgroup.com ");
define("HEADER","INVOICE");
defined('BASE_URL')	|| define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl());

$brach_name =  $this->branch;
?>

<script language="javascript">
function Clickheretoprint()
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=1100, height=300, left=100, top=25"; 
  var content_vlue = document.getElementById("print_content").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>Stock inventory System</title>'); 
   docprint.document.write('</head><body onLoad="self.print()" style=" margin:0px; font-family:Verdana; font-size:10px;"><center>');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</center></body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}
</script>
<title>Sales Report</title>
<div class="right">
	<div class="wrapper">
		<div class="view-table shadow">
			<form id="frm" method="post">
			<br /><br />
				<table class="height" width="100%">
					<tr class="height">
						<td><?php echo $tr->translate("ITEM");?></td>
						<td><?php echo $frm_sales_report->getElement("item");?></td>
						<td><?php echo $tr->translate("LOCATION_NAME");?></td>
						<td><?php echo $frm_sales_report->getElement("LocationId");?></td>
					</tr>
					<tr class="height">
						<td><?php echo $tr->translate("FROM_DATE");?></td>
						<td width="40%"><?php echo $frm_sales_report->getElement("start_date");?></td>
						<td><?php echo $tr->translate("END_DATE");?></td>
						<td  width="30%"><?php echo $frm_sales_report->getElement("end_date");?></td>
					</tr>
					<tr class="height">
						<td></td><!-- <a href="javascript:Clickheretoprint()"> Click To test Print</a> -->
						<td></td>
						<td></td>
						<td><input type="submit" value="<?php echo $tr->translate("SEARCH")?>" class="ui-button ui-widget ui-state-default ui-corner-all ui-state-hover" name="btn_search" name="btn_search" /></td>
					</tr>
				</table>
			</form>
			<?php $sales_item = $this->getsales_item;
			if($sales_item!=""):
			?>
			<input type="button" value="" class="print" onClick="Clickheretoprint()" />
			<!-- <input type="button" value="" class="print" onClick="window.open('<?php echo $url_print;?>','mywindow','width=600,height=300,scrollbars=yes')">-->
			<div id="print_content">
				<div style="background:rgb(237, 247, 248); padding:10px 0px 15px 0px;border-top:1px solid #ccc;">
					<table class="" width="96%" style="border:1px solid #000; margin:30px 2%;" border="1">
						<thead>
								<br /><br />
							<tr style="background:#fff; padding:10px 5px; height:120px;">
							
									<td colspan="5"><?php echo COM_ADD; ?><!-- <img src="<?php //echo BASE_URL;?>/images/logo.png" /> -->
										<div style="float:right">
										<?php if(!empty($brach_name))
										 	echo "<b>Branch Name : </b>".$brach_name["Name"];
										else{
											echo "<b>Branch Name : </b> All Branch ";
										}?>
										</div>
									</td>
						   </tr>
					   </thead>
							<tr height="35" class="height" style="background:#E4E4E4;">
								<th><?php echo $tr->translate("NUM");?></th>
								<th><?php echo $tr->translate("ITEM_NAME");?></th>
								<th><?php echo $tr->translate("ITEM_CODE");?></th>
								<th colspan="2"><?php echo $tr->translate("QTY_SALES");?></th>
							</tr>
					 <?php $num=1; foreach ($sales_item AS $index => $item):?>
							<tr height="30" class='row-format<?php echo $num; $num=1-$num;?>'>
								<td align="center"><?php echo $index+1?></td>
								<td>&nbsp;<?php echo $item["item_name"]?></td>
								<td>&nbsp;<?php echo $item["p_code"]?></td>
								<td colspan="2">&nbsp;<?php echo $item["qty"]?></td>
							</tr>
					<?php endforeach; ?>
						<tr height="35" class='row-format<?php echo $num; $num=1-$num;?>'>
								<td align="right" colspan="2"><?php echo $tr->translate("REPORT_ON_DATE");?>&nbsp;&nbsp;</td>
								<td colspan="3"><?php echo" : ". $this->start_date." To ".$this->end_date;?></td>
						</tr>
				</table>
			</div>
		</div><!-- print content -->
		<?php endif;?>
		</div>
	</div>
</div>
<script>
	$("#item").chosen();
	$("#LocationId").chosen();
</script>